function [ hasil,hasil2 ] = y_RK42( f, x0, y0 , y1, b, h )
%Y_RK4 Summary of this function goes here
%   Menghitung y(b) dengan metode Runge-Kutta orde empat pada PDB
%   y' = f(x,y); y(x0)=y0
    n = (b - x0)/h; %jumlah langkah
    y = y0;
    x = x0;
    y2 = y1;
    syms a b c;
    for r = 2 : n+1
        k1 = y2* h + (h/2) * h * subs(f, [a b c], [x y y2]);
        
        k2 = y2* h + (h/2) * h * subs(f, [a b c], [(x + h / 2) (y + k1 / 2) y2]);
        
        k3 = y2* h + (h/2) * h * subs(f, [a b c], [(x + h / 2) (y + k2 / 2) y2]);
        
        k4 = y2* h + (h/2) * h * subs(f, [a b c], [(x + h) (y + k3) y2]);
        
        k5 = h * subs(f, [a b c], [x y y2]);
        
        k6 = h * subs(f, [a b c], [(x + h / 2) (y + k5 / 2) y2]);
        
        k7 = h * subs(f, [a b c], [(x + h / 2) (y + k6 / 2) y2]);
        
        k8 = h * subs(f, [a b c], [(x + h) (y + k7) y2]);
        
        y = y + (k1 + 2 * k2 + 2 * k3 + k4) / 6;
        y2 = y2 + (k5 + 2 * k6 + 2 * k7 + k8) / 6;
        x = x + h;
    end
    hasil = y;
    hasil2 = y2;
end

